<script src="../../routers/main.js"></script>
<script src="../../models/blog.js"></script>
<script src="../../routers/admin.js"></script>
<script src="../../routers/api.js"></script>{% extends 'layout.html'%}
{% block title%}用户编辑{%endblock%}
{% block body%}
{% block scripts%}
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
    $(function(){
        let $name =$("#name");
        let $userId =$("#userId");
        let $psw = $('#psw');
        $("#submit").click(function(){
            $.post("/admin/user/change",{
                    userId :$userId.val(),
                    name:$name.val(),
                    psw:$psw.val(),
                },
                function(result){
                        alert(result.msg)
                    window.location.href='/admin/user?page=1'
                });
        });
    });
</script>
{%endblock%}
<form>
    <input id="userId" hidden value="{{user._id.toString()}}">
    <div class="form-group" >
        <h4>修改用户名</small></h4>
        <input id="name" type="text" class="form-control" placeholder="用户名" value="{{user.userName}}">
        <h4>修改密码</small></h4>
        <input id="psw" type="text" class="form-control" placeholder="密码" value="{{user.passWord}}">
    </div>
</form>

<button id="submit" type="button" class="btn btn-primary btn-lg btn-block">提交</button>
{% endblock%}